home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / pascal / scanh313.zip / SCANHELP.DOC < prev    next >
Text File  |  1993-10-22  |  22KB  |  551 lines

  1. SCANHELP - Utility to produce help files from TP source code.
  2.  
  3.     Version 3.13 - update by D.J. Murdoch to TurboPower's utility.
  4.  
  5.     This update is copyright (1991, 1993) D.J. Murdoch.  It contains
  6.     public domain code written by TurboPower Software, and code licensed
  7.     from TurboPower and Borland.
  8.  
  9. SYNTAX
  10.  
  11.     SCANHELP [options] filespec [filespec...]
  12.  
  13.      Parses the interface section of Turbo Pascal 4.0 to 7.0 units to
  14.      produce a help file summarizing the public methods, procedures, and
  15.      functions.
  16.  
  17.     Filespec:  list of input files.  May contain wildcards.
  18.  
  19.     Options:
  20.        /S    sort the "See also" tables
  21.        /I dirs      search list for include files
  22.        /O filename  output filename
  23.        /FB   write Borland .TPH format
  24.        /FH   write HELPC .HDF format
  25.        /FP   write MAKEHELP .TXT format
  26.        /FT   write TeX .TEX format
  27.  
  28. SUMMARY
  29.  
  30.     SCANHELP is designed to produce help files from Turbo Pascal source
  31.     code.  These are good enough to use for your own reference, and
  32.     should serve as a good base for help files that you write for
  33.     others.
  34.  
  35.     Version 3.13 can produce four kinds of help files:  *.TXT files,
  36.     for use as input to TurboPower Software's MAKEHELP utility; *.TPH
  37.     files, for use with Borland's THELP 3.0 or Pascal 7.0+ IDE; *.TEX
  38.     files, for input to Knuth's TeX text processor (using the LaTeX
  39.     macro package); and *.HDF files, for use with Ron Loewy's Help
  40.     Development Kit. The first two give you instantaneous keyword
  41.     searches; the third gives a professional-looking indexed manual,
  42.     and the last gives you input files that will work with
  43.     help compilers for Windows 3.0 and 3.1, OS/2, and DESQview/X, among
  44.     others.
  45.  
  46. REQUIREMENTS
  47.  
  48.     *.TXT:  The TurboPower MAKEHELP utility is needed to compile the
  49.     help file, and their POPHELP utility is needed to view them.
  50.     Contact TurboPower Software at 800-333-4160 or 719-260-9136 for
  51.     details on how to obtain these.
  52.  
  53.     *.TPH:  These files work directly with the version 7.0 Borland
  54.     Pascal IDEs, and may work with current BC++ IDEs.  You can also use
  55.     version 3.0 (or later?) of the THELP utility for access outside the
  56.     IDE.
  57.  
  58.     *.TEX:  You'll need a copy of the TeX text processor, the LaTeX
  59.     macro package, and if you want an index, the MakeIndex (or MAKEINDX)
  60.     utility.  There are several good free implementations of this; I
  61.     recommend emTeX, by Eberhard Mattes.  It comes with drivers for
  62.     screen previewers and Postscript, Laserjet, or dot-matrix output.
  63.  
  64.     *.HDF:  This format is designed for use with version 7.0 of Ron
  65.     Loewy's Help Development Kit, HLPDK70.ZIP.  For most of the target
  66.     formats, you'll also need a separate help compiler:  HC or HC31 for
  67.     Windows, the IPFC compiler for OS/2, DVXHLP10.ZIP for DESQview/X.
  68.  
  69. AIMS
  70.  
  71.     SCANHELP version 1 was one of TurboPower's Help Tools, released to
  72.     the public domain in January 1990.  It was designed to create an
  73.     outline for a help database describing the interface to a Turbo
  74.     Pascal unit; the assumption was that the user would make major
  75.     modifications to the outline to produce a polished help system.
  76.  
  77.     I wanted something different:  I wanted documentation for myself,
  78.     and I wanted it to be easy to produce.  I've found that it's too
  79.     easy for printed documentation to get out of synch with the source
  80.     code when the code is under development; even my online
  81.     documentation kept falling behind, because it was just too much
  82.     trouble to go to the *.TXT file and correct the documentation when I
  83.     made a small change.
  84.  
  85.     The design aim for SCANHELP 2 was thus to produce complete *.TXT
  86.     files, suitable for input to MAKEHELP.  These were to be good enough
  87.     for internal use without any manual editing.  It was possible to
  88.     customize them by working within the original *.PAS source code;
  89.     duplicate documentation was not necessary.
  90.  
  91.     SCANHELP 3 has the same aim, but I've added *.TPH capability to give
  92.     it a wider audience.  The *.TEX capability makes it much easier to
  93.     proofread help screens; you don't have to hope that you go through
  94.     every topic, you can print them as a book and read through.
  95.  
  96.     Some other things I've attempted to do, with varying success:
  97.  
  98.      - produce documentation for *every* interfaced symbol
  99.  
  100.      - have a minimal impact on the source code, i.e. existing source
  101.      code should produce reasonable help files without substantial
  102.      changes
  103.  
  104.      - handle multiple source files, so cross references to other units
  105.      are possible
  106.  
  107.      - work with Pascal scoping rules, so that cross references are
  108.      easy.
  109.  
  110. DETAILS of TOPIC CREATION
  111.  
  112.     SCANHELP is used to create help systems for program libraries. The
  113.     input is one or more Turbo Pascal source code files; the output is
  114.     some form of help file.  This section defines the source files and
  115.     generalities applying to all help file types; below the specifics of
  116.     each are given.
  117.  
  118.     SCANHELP creates help topics for every interfaced identifier in a
  119.     program: object, method, procedure, function, variable, constant.
  120.     The text of each help topic has several parts:
  121.  
  122.       - the declaration of the identifier
  123.  
  124.       - the comments following the declaration, up until the next
  125.       declaration begins.
  126.  
  127.       - (for identifiers that define a scope, e.g. record or object
  128.       types), lists of the identifiers are added to the help topic to
  129.       serve as cross-references.
  130.  
  131.       - a "See also" list, if you use the #X directive (see below).
  132.  
  133.     Most references to other identifiers in the declaration are also
  134.     used to form cross references; for example, if a function has
  135.     declaration
  136.  
  137.       function MyFunc(a: MyType):MyOtherType;
  138.  
  139.     it will generally be given cross-references on both the MyType and
  140.     MyOtherType identifiers.  It's also possible to create
  141.     cross-references within the text of a comment by surrounding a name
  142.     with "#" marks.
  143.  
  144.     Often there will be several different uses of the same identifier in
  145.     a program.  For example, "Init" is commonly used as an object
  146.     constructor name.  SCANHELP uses approximately Pascal scoping rules
  147.     in determining what you're referencing:
  148.  
  149.       - in a record or object declaration, the local fields/methods are
  150.       in scope
  151.  
  152.       - if the name isn't found there, then the interfaced identifiers
  153.       are searched
  154.  
  155.       - if it's still not found, the uses list is searched (in reverse
  156.       order, just like TP does)
  157.  
  158.       - if not found here, TP would give a compiler error, but SCANHELP
  159.       continues on for one more step:  other units in the library are
  160.       also searched, even if the unit doesn't use them.
  161.  
  162.     The other difference between the TP search and SCANHELP's search is
  163.     that SCANHELP can resolve forward references.  You can have things
  164.     like
  165.  
  166.       function FirstFunction:Integer;
  167.       { This is the first function; you should see #SecondFunction#! }
  168.  
  169.       function SecondFunction:Integer;
  170.       { This is the second function; you should see #FirstFunction#! }
  171.  
  172.     and SCANHELP will know what both # references are talking about.
  173.     This will occasionally lead to errors, if you have such abominations
  174.     as
  175.  
  176.       type
  177.         integer = word;
  178.         word = integer;
  179.  
  180.     which are likely to confuse SCANHELP (and you!).
  181.  
  182.     If you want to override the search possibility, then you can use a
  183.     qualified name.  For example, #TBase.Init# is fine as a
  184.     cross-reference, provided the usual search rules can find TBase.
  185.  
  186. DIRECTIVES
  187.  
  188.     SCANHELP has several directives for customizing its behaviour.
  189.     Directives are placed in the source code before running SCANHELP.
  190.  
  191.     All directives have the format {#L...} where:
  192.       {  }   are normal comment braces
  193.       #      signals that this is a SCANHELP directive
  194.       L      is a command letter
  195.       ...    are one or more parameters for the directive
  196.  
  197.     #F
  198.  
  199.      This directive toggles fixed format mode.  In fixed format mode,
  200.      word wrapping doesn't apply to comments.  Note that word wrapping
  201.      always applies to the declaration of the object.
  202.  
  203.     #M
  204.  
  205.      This directive toggles "marked text mode".  The behaviour of this
  206.      depends on the particular help format chosen, but generally
  207.      speaking, it should be used to mark examples of usage.  Note that
  208.      #F can be used to start fixed format within marked text, but text
  209.      marking shouldn't be started within fixed format.
  210.  
  211.     #T Topic [comment]
  212.  
  213.      This directive creates a new topic and a new identifier in the
  214.      current scope.  SCANHELP parses it as a new declaration.
  215.      For example:
  216.  
  217.       type Myrec = record
  218.         { this comment will go into the Myrec topic }
  219.         a : word;
  220.         { this comment will go into the Myrec.a topic }
  221.         {#T about_myrec}
  222.         { this comment will go into a Myrec.about_myrec topic, with
  223.           an embedded cross-reference to #a#. }
  224.         b : word;
  225.         { this comment will go into the Myrec.b topic, with cross
  226.           references to the other two topics. }
  227.         {#X about_myrec a}
  228.       end;
  229.  
  230.      You can use #X directives after #T; this will create See Also
  231.      entries in the #T topic.  Other #X directives can refer to the #T
  232.      topic, using the topic name, as shown after the Myrec.b comment
  233.      above.
  234.  
  235.     #X [Object.]Topic [[Object.]Topic...]  Include cross-reference
  236.  
  237.      This directive specifies that Topic is to be included in the "See
  238.      also" list for the current symbol.
  239.  
  240.      You can have as many topics in one #X directive as you like. Or,
  241.      you can specify multiple #X directives.  For example, the following
  242.      are equivalent:
  243.  
  244.        {#X TopicA TopicB TopicC}
  245.  
  246.      and
  247.  
  248.        {#X TopicA}
  249.        {#X TopicB}
  250.        {#X TopicC}
  251.  
  252.     #Z+ / #Z-   Toggle Private
  253.  
  254.      This directive controls what symbols are included in the help text.
  255.      The default is all interfaced objects, methods, procedures and
  256.      functions. If you want to exclude one or more these symbols, then
  257.      place a {#Z+} directive in front of them and a {#Z-} directive
  258.      following. The Z+ signals that all following symbols are private
  259.      and should not be included in the help text. The Z- turns off the
  260.      "private" attribute.
  261.  
  262.  
  263.  
  264. COMMAND LINE OPTIONS
  265.  
  266.     Some of SCANHELP's behavior is customized from the command line.
  267.     Here is the command line format:
  268.  
  269.       SCANHELP [options] unitname [unitname...]
  270.  
  271.     Options:
  272.  
  273.       /I dirs    Search list for include files
  274.  
  275.         If your files have $I directives to include other source,
  276.         SCANHELP will use the directories specified here to find it.
  277.  
  278.       /S  sort cross-references
  279.  
  280.         The default behavior for the cross-reference table (the See
  281.         also's) is to present the cross-references in the same order
  282.         they appear in the #X directives in the source code. The /S
  283.         options gives the list in sorted order.
  284.  
  285.       /O file[.TPH|.TXT|.TEX]   Output filename
  286.  
  287.         SCANHELP normally names the output filename the same as the
  288.         first unit it scans.  Use this directive to override that
  289.         behaviour.  The default extension is .TXT for a MAKEHELP input
  290.         file, .TPH for Borland help files, .TEX for a TeX file, and
  291.         .HDF for a HELPC source file.
  292.  
  293.       /FP  Make POPHELP database
  294.       /FB  Make Borland .TPH database [default]
  295.       /FT  Make TeX help file
  296.       /FH  Make HELPC .HDF format
  297.  
  298.         By default, SCANHELP will produce a compiled .TPH file.  If you
  299.         want to use the output with POPHELP, use /FP, and then
  300.         compile the output with TurboPower's MAKEHELP utility.
  301.  
  302. MAKEHELP/POPHELP SPECIFICS
  303.  
  304.     The help file created by SCANHELP will create an index entry for
  305.     every identifier, and will have hypertext links for jumping between
  306.     all cross-references.  The text width will be set to 78 characters
  307.     by a directive at the beginning of the file; when MAKEHELP compiles
  308.     it, all line breaks will be fixed in place at that width.  A single
  309.     topic called Contents will be created in the first place in the
  310.     index, with a list of all documented units.
  311.  
  312.     The #F directive will stop MAKEHELP from word wrapping, and the #M
  313.     directive will mark the block with ^C characters.  In the default
  314.     POPHELP colour scheme, this changes the text colour to dark blue
  315.     from black.
  316.  
  317.     The standard process for creating a MAKEHELP help text is as
  318.     follows:
  319.  
  320.      1. Annotate source listings with # directives.
  321.  
  322.      2. Run SCANHELP on all files (wildcards ok) with the /FP option,
  323.      and probably a /O option to give the output filename.
  324.  
  325.      3. Run MAKEHELP to compile the output file into a POPHELP database.
  326.  
  327.      4. Run POPHELP to load itself as a TSR to use the database.
  328.  
  329. BORLAND .TPH SPECIFICS
  330.  
  331.     The help file created by SCANHELP will create an index entry for
  332.     every identifier, with a subtitle from the enclosing scope (i.e. the
  333.     unit name, record type, or object type).  The subtitles will only
  334.     show up in the IDE (THELP ignores them) when there are collisions
  335.     between the names---then there will be a single index entry, with
  336.     multiple subtitles shown below.
  337.  
  338.     The .TPH will have hypertext links for jumping between all
  339.     cross-references.  No lines will have fixed width unless the #F
  340.     directive is used; the IDE or THELP will re-wrap all of the lines to
  341.     fit in the visible window. A single topic called Contents will be
  342.     created, with a list of all documented units.  It will be the first
  343.     topic that THELP displays.
  344.  
  345.     The #F directive will stop comment lines from wrapping, and will
  346.     preserve any leading spaces in the comments.
  347.  
  348.     The #M directive will mark text as a code example, so that the IDE
  349.     will insert it into your text.  Use the Help window local menu
  350.     (Alt-F10 brings this up) to get the option to copy the text to your
  351.     clipboard, then use the usual Shift-Insert command to insert it into
  352.     your edit buffer.
  353.  
  354.     The standard process for creating a Borland help file is as
  355.     follows:
  356.  
  357.      1. Annotate source listings with # directives.
  358.  
  359.      2. Run SCANHELP on all files (wildcards ok) with the /FB (or no /F)
  360.      option, and probably a /O option to give the output filename.
  361.  
  362.      3.(a) Run THELP with the /Ffilename option to load the database as a
  363.      TSR, or
  364.  
  365.      3.(b) Load the help database into the IDE by using the /Help Files New
  366.      dialog.  Be sure to hit the OK button (or type K); if you hit Esc, your
  367.      request will be ignored.
  368.  
  369. TeX SPECIFICS
  370.  
  371.     The output file produced with the /OT option is meant to be run as a
  372.     single document under the LaTeX macro package.  The SCANHELP.STY
  373.     file is used to define the appearance of the document.  If you make
  374.     no changes to it, then the style will be very similar to the style
  375.     used in the Reference sections of Borland manuals:  major topics
  376.     will be set off with lines, and fields and methods will be shown
  377.     within the major topic defining their type. The index will contain a
  378.     bold face index entry for the definition of every identifier, and a
  379.     standard entry for all cross-references. TeX will fill lines to fit
  380.     your page width.
  381.  
  382.     The #F directive puts LaTeX into a "verbatim" environment; this uses
  383.     the formatting from your comments in a typewriter style typeface.
  384.     The #M directive marks a block as an example, with a note in the
  385.     margin the way the Borland manuals do it.
  386.  
  387.     The standard process for creating TeX help document is as follows:
  388.  
  389.      1. Annotate source listings with # directives.
  390.  
  391.      2. Run SCANHELP on all files (wildcards ok) with the /FT
  392.      option, and probably a /O option to give the output filename.
  393.  
  394.      3. Run TeX with LaTeX on the output file.  How to do this will
  395.      depend on your local installation; on mine, it's just
  396.  
  397.         LATEX filename
  398.  
  399.      4. Run the MakeIndex program to compile the document index.  With
  400.      the emTeX version of TeX, this is done by
  401.  
  402.         MAKEINDX filename
  403.  
  404.      where the filename is your help filename *without the extension*.
  405.  
  406.      5. Run LATEX again on your file; this time the index will be
  407.      incorporated into the document.
  408.  
  409.      6. Print the .DVI file using a driver suitable for your printer;
  410.      for example,
  411.  
  412.         lpr -d filename.dvi
  413.  
  414.      is the method that works on our network or on many Unix machines.
  415.  
  416. HelpDK Specifics
  417.  
  418.      SCANHELP will produce one indexed help topic for each identifier.
  419.      Subtitles aren't supported.  While HelpDK does produce input
  420.      files for both Borland's help compiler and TurboPower's, you'll
  421.      probably get better results using those specific options (/FB and
  422.      /FP) rather than this generic one.
  423.  
  424.      Neither #F nor #M directives are supported.  They will be stripped
  425.      from the comments and ignored.
  426.  
  427.      The general procedure to use is as follows.
  428.  
  429.      1. Annotate your source listings with # directives.
  430.  
  431.      2. Run SCANHELP on all files (wildcards ok) with the /FH option,
  432.         and probably a /O option to give the output filename.
  433.  
  434.      3. Run HELPC with the option specific to your target database:
  435.  
  436.          /PX or /MT   - for HelpDK's own help engine
  437.          /W30 or /W31 - for Windows 3.0/3.1 source
  438.          /TH          - for Borland THELP source
  439.          /QH          - for Microsoft QuickHelp source
  440.          /TV          - for Borland TVHC source
  441.          /PH          - for TurboPower POPHELP source
  442.          /XD          - for DESQview/X source
  443.          /OS2         - for OS/2-IPF Source
  444.          /TXT         - Generate printable .TXT file
  445.  
  446.      4. See the instructions in the HelpDK file HLPDK.DOC for the final
  447.         compile step suitable to each target.
  448.  
  449.      For example, for Windows 3.1 the steps would be:
  450.  
  451.          SCANHELP *.pas /Omyhelp /FH
  452.          HELPC /W31 myhelp
  453.          HC31 myhelp
  454.  
  455.      where SCANHELP is in this package, HELPC is in the HLPDK70.ZIP package,
  456.      and HC31 is in Microsoft's SDK, or other Windows programming packages
  457.      like Borland Pascal or Turbo Pascal for Windows.
  458.  
  459.  
  460. FILES
  461.  
  462.     SCANHELP.EXE    The executable
  463.     SCANHELP.DOC    This file
  464.     SCANHELP.STY    The TeX style file for help documents
  465.     HELPFILE.PAS    One of the source files to SCANHELP
  466.     HELPFILE.PS     Postscript copy of TeX output from
  467.                       SCANHELP helpfile /ft
  468.                     Print this if you want to see whether it's worth
  469.                     getting TeX.
  470.  
  471. CHANGE HISTORY
  472.  
  473.     1.01  10-8-90
  474.         SCANHELP - Changed .Z to #Z to agree with documentation
  475.  
  476.     1.02  3-7-91
  477.         SCANHELP - Fixed "xref line too long" bug
  478.  
  479.     2.00Alpha  1-Dec-91
  480.           Major changes by DJM.
  481.  
  482.     2.00Alpha2 Added /O option.
  483.  
  484.     2.00Alpha3 Added embedded cross-references.
  485.  
  486.     2.03  2.00Alpha3 with a more reasonable name. :-)
  487.  
  488.     2.04  Fixed bug - #Z+ was being ignored by comment saver
  489.  
  490.     3.00  Added Borland .TPH file and TeX support, changed a lot of the
  491.           formatting, internal structure, and symbol table methods, and
  492.           deleted a lot of the old options.
  493.  
  494.     3.10  Added .HDF file support, and #F and #M directives, and fixed
  495.           bugs:  SCANHELP no longer asks for a numeric coprocessor; long
  496.           identifiers don't cause trouble.
  497.  
  498.     3.12:  Fixed bug on #Z+, increased speed for .TPH files.
  499.  
  500.     3.13:  Fixed bug in fixed line handling.
  501.  
  502. LICENSE
  503.  
  504.     This program is shareware, not public domain.  It contains public
  505.     domain code written by TurboPower Software, and makes use of
  506.     copyright libraries by Borland International and TurboPower
  507.     Software, but the majority of the code is written by and belongs to
  508.     Duncan Murdoch.
  509.  
  510.     You are licensed to distribute this program unchanged, provided you
  511.     charge no more than reasonable distribution costs, and in no case
  512.     more than $10 (US) for it.
  513.  
  514.     You are also licensed to use it personally at no charge.  This means
  515.     that you may compile and use help files on any number of computers,
  516.     but only if you are their only reader:  you may not distribute them
  517.     to other people.  (Of course, if you distribute your source code to
  518.     other people, you can give them instructions on how to use SCANHELP
  519.     to produce their own personal help files.)
  520.  
  521.     If you want to distribute help files produced by SCANHELP, you must
  522.     register the program with me.  An additional benefit of registration
  523.     is that I will send you a diskette containing a number of other
  524.     utilities I've written to help with Turbo Pascal programming, DOS
  525.     and Windows.  One of them that is not currently available elsewhere
  526.     is FINDHELP; it searches Borland help files for keywords that aren't
  527.     indexed.  Please tell me your preferred diskette format.
  528.  
  529.     Registration costs $25 (US or Canadian).  Send a cheque or money
  530.     order for that amount to
  531.  
  532.       Duncan Murdoch
  533.       337 Willingdon Ave.
  534.       Kingston, Ontario, Canada.
  535.       K7L 4J3
  536.  
  537.     Source code to SCANHELP is available to registered users for an
  538.     additional $25 (i.e. $50 total).  Recompiling SCANHELP will require
  539.     TurboPower's Object Professional library together with their Turbo
  540.     Analyst package; however, the Borland help file unit requires only
  541.     simple data manipulation routines from Object Professional.
  542.  
  543.     I'd like to hear bug reports, and suggested improvements.
  544.     Please send those to me at the address above, or by email to one of
  545.     the following addresses:
  546.  
  547.      Fidonet:    DJ Murdoch at 1:249/99.5
  548.      Internet:   dmurdoch@mast.queensu.ca
  549.      Compuserve: 71631,122
  550.  
  551.